/**
 * 
 */
package org.third.test;

import static org.junit.Assert.assertThat;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

/**
 * @author gongyo
 *
 */
class StaticTest {
    public static String sayHi(String hi) {
        return "ABC:" + hi;
    }
}

@RunWith(PowerMockRunner.class)  
@PrepareForTest(StaticTest.class)
public class PowerMock {

    @Test
    public void testSayHi() {
        PowerMockito.mockStatic(StaticTest.class);
        PowerMockito.when(StaticTest.sayHi(Mockito.anyString())).thenReturn("static");
        String result = StaticTest.sayHi("Test");
        assertThat(result, org.hamcrest.Matchers.equalTo("static"));
    }

}
